<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <input type="text" placeholder="商品标题" v-model="p.title">
    <input type="text" placeholder="商品价格" v-model="p.price">
    <input type="text" placeholder="商品库存" v-model="p.num">
    <input type="button" value="添加商品" @click="insert()">
</div>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<script>
  let v = new Vue({
    el:"body>div",
    data:{
        p: {title: "", price: "", num: ""}
    },
    methods:{
        insert() {
            axios.post("/insert",v.p).then(function () {
                alert("添加完成！");
            })
        }
    }
  })
</script>
</html>